package com.googlecode.designrules;

import org.designwizard.design.PackageNode;
import org.designwizard.exception.InexistentEntityException;
import org.designwizard.main.DesignWizard;

public abstract class DesignAssert {

	protected final DesignWizard designWizard;

	public DesignAssert(DesignWizard dw) {
		this.designWizard = dw;
	}

	protected final void fail(String message) {
		throw new AssertionError(message == null ? "" : message);
	}

	protected final PackageNode getPackage(String name) {
		try {
			return designWizard.getPackage(name);

		} catch (InexistentEntityException e) {
			throw new AssertionError("Package does not exist: " + name);
		}
	}

}
